package com.ruoyi.sample.mapper;

import com.ruoyi.experiment.domain.Circulation;
import com.ruoyi.experiment.domain.Project;
import com.ruoyi.experiment.domain.Sample;
import com.ruoyi.experiment.model.TreeSample;
import com.ruoyi.sample.model.SItem;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 样品Mapper接口
 *
 * @author ruoyi
 * @date 2024-06-11
 */
public interface SampleMapper
{
    /**
     * 查询样品
     *
     * @param sampleId 样品主键
     * @return 样品
     */
    public Sample selectSampleBySampleId(Long sampleId);

    /**
     * 查询样品列表
     *
     * @param sample 样品
     * @return 样品集合
     */
    public List<Sample> selectSampleList(Sample sample);
    public List<Sample> selectAllSampleBySid(List<Long> ids);
    public List<TreeSample> selectSampleRoot(Sample sample);
    List<TreeSample> selectTreeSamples(@Param("parentId") Long parentId);
    /**
     * 新增样品
     *
     * @param sample 样品
     * @return 结果
     */
    public int insertSample(Sample sample);

    /**
     * 修改样品
     *
     * @param sample 样品
     * @return 结果
     */
    public int updateSample(Sample sample);

    /**
     * 删除样品
     *
     * @param sampleId 样品主键
     * @return 结果
     */
    public int deleteSampleBySampleId(Long sampleId);

    /**
     * 批量删除样品
     *
     * @param sampleIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSampleBySampleIds(Long[] sampleIds);

    List<SItem> selectAllItem(Project project);
    int insertFlume(Circulation circulation);

    void updateProject(Long id);

    List<Integer> selectSampleStatusBySampleIds(Long[] sampleIds);

    Sample selectParentSample(Long id);


    /**
     * 专用于解决制备小样品后又删除的情况
     * @param id
     * @return
     */
    int updateSampleStatus(Long id);

    Integer checkSampleName(@Param("projectId") Long pid,@Param("name") String name);

}
